/********************************************************************************
 *      Copyright:  (C) 2022 zengwen<1825984037@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  mqtt_conf.h
 *    Description:  This head file 
 *
 *        Version:  1.0.0(18/07/22)
 *         Author:  zengwen <1825984037@qq.com>
 *      ChangeLog:  1, Release initial version on "18/07/22 16:10:48"
 *                 
 ********************************************************************************/
#include "sqlite3.h"
#ifndef _MQTT_CONF_H_
#define _MQTT_CONF_H_ 

#define SIZE                   256
#define KEEP_ALIVE             60
#define DEFAULT_QOS            0

#define DEFAULT_METHOD         "thing.service.property.set"
#define DEFAULT_JSONID         "id"
#define DEFAULT_IDENTIFIER     "CurrentTemperature"
#define DEFAULT_VERSION        "1.0.0"


typedef struct mqtt_user_data
{
	    char    brokeraddress[SIZE] ;
		int     brokerport;
	    char    username[SIZE];
		char    password[SIZE];
		char    clientid[SIZE];
		char    topic[SIZE];


}mqtt_user_data;

typedef struct common_data
{
	char    db_file[SIZE];
	char    log_file[SIZE];
	int     t_interval;
	int     level;
	int     size;
	char   *platform;
}common_data;

typedef struct total_data
{
	mqtt_user_data  mqtt;
	common_data     common;
	time_t          last_time;
	int             flag;
	int             sq_flag;
	char           *platform;
	char            msg[SIZE];
	char            buf[SIZE];
	sqlite3        *db;
}total_data;

extern int get_config(char *path,struct total_data *mqtt,char *platform);

#endif
